Skip to content

Conversation

@tzolov
Copy link
Contributor

@tzolov tzolov commented Mar 10, 2025

Enhances MCP tool naming by prefixing tool names with their client + transport name to prevent conflicts when multiple MCP clients expose tools with the same name.

  • Modifies client info in McpClientAutoConfiguration to include transport name
  • Updates SyncMcpToolCallback and AsyncMcpToolCallback to prefix tool names with client + transport name
  • Adds test coverage for tools with identical names but different client info

Resolves #2393

McpSchema.Implementation clientInfo = new McpSchema.Implementation(commonProperties.getName(),
commonProperties.getVersion());
McpSchema.Implementation clientInfo = new McpSchema.Implementation(
commonProperties.getName() + " - " + namedTransport.name(), commonProperties.getVersion());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to move this logic to a method for reusability and consistency across.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure. It is addressed

Enhances MCP tool naming by prefixing tool names with their client + transport name
to prevent conflicts when multiple MCP clients expose tools with the same name.

- Modifies client info in McpClientAutoConfiguration to include transport name
- Updates SyncMcpToolCallback and AsyncMcpToolCallback to prefix tool names with client + transport name
- Adds test coverage for tools with identical names but different client info

Resolves spring-projects#2393

Signed-off-by: Christian Tzolov <[email protected]>
@tzolov tzolov force-pushed the mcp-tool-name-auto-prefix branch from 78afac9 to 9571501 Compare March 11, 2025 12:15
@ilayaperumalg ilayaperumalg merged commit 9571501 into spring-projects:main Mar 11, 2025
2 checks passed
@ilayaperumalg
Copy link
Member

Rebased and merged as 9571501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP Client cannot connect to two or more MCP Servers with the same tool names

2 participants